<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- <global-com name='张三' age=19></global-com> -->
    <aaa name='张三' age=19></aaa>

    <global-com :name='myname' :age='myage'></global-com>

  </div>

  <template id="tmp1">
    <div>
        <h1>我是全局组件1的模板-----{{msg}}</h1>
        <a href="#">百度</a>
        <h2>{{name}}===={{age}}</h2>
    </div>
  </template>

  <!-- 1. html标签里面设置属性 2. 组件里面设置props接受数据 3. template里面调用数据 -->
  <script src="./vue.js"></script>
  <script>
      Vue.component("globalCom",{
        //   template:`<h1>我是全局组件</h1>`
        props:['name','age'],
        template: '#tmp1',
        data() {
            return {
                msg:"template msg"
            }
        }
      })

    var vm = new Vue({
      el:'#app',
      data:{
          myname:'weige',
          myage:18
      },
      components: {
          aaa: {
            props:['name','age'],
              template:'#tmp1',
              data() {
                  return {
                      msg:"template msg"
                  }
              }
          }
      }
     });
  </script>
</body>
</html>
